﻿using System;
using Microsoft.VisualStudio.Text.Editor;
using System.Windows.Input;
using System.Diagnostics;

namespace CodeJumper
{
    internal class MouseProcessor : MouseProcessorBase
    {
        private IWpfTextView _textView;
        ElementView elementView;

        public MouseProcessor(IWpfTextView wpfTextView)
        {
            this._textView = wpfTextView;
        }

        public override void PreprocessMouseWheel(MouseWheelEventArgs e)
        {
            try
            {
                if (this.elementView == null)
                {
                    this._textView.Properties.TryGetProperty<ElementView>("ElementViewUI", out this.elementView);
                }
                if ((this.elementView != null) && this.elementView.IsMouseOver)
                {
                    this.elementView.ScrollByEvent(e);
                    e.Handled = true;
                    return;
                }
            }
            catch (Exception)
            {
            }
            base.PreprocessMouseWheel(e);
        }

        

    }
}
